import 'package:word_game/engine/core.dart';
import 'material/full_bucket.dart';

class FetchWaterEvent extends Eventable {
  FetchWaterEvent() : super('打水');
  @override
  void doEvent(owner) {
    Thing emptyBucket;
    for (var item in World.instance.hero.bag.things) {
      if (item.code == 'empty_bucket') {
        emptyBucket = item;
        break;
      }
    }
    if (emptyBucket == null) {
      Engine.instance.displayer.displayString('你没有空水桶，无法打水。');
      return;
    }
    World.instance.hero.pureRemoveThing(emptyBucket);
    World.instance.hero.getThing(FullBucket('2'));
  }
}